const path = require("path");
function resolve(dir) {
  return path.join(__dirname, dir);
}

module.exports = {
  chainWebpack: config => {
    config.resolve.alias
      .set("@", resolve("src"))
      .set("assets", resolve("src/assets"))
      .set("components", resolve("src/components"))
      .set("views", resolve("src/views"))
      .set("router", resolve("src/router"))
      .set("store", resolve("src/store"))
      .set("network", resolve("src/network"))

  },
  // 配置跨域
  devServer: {
    open: true,
    host: 'localhost',
    port: 8087,
    https: false,
    hotOnly: false,
    proxy: {
      '/api': {
        target: 'https://elm.cangdu.org',
        wa: true,
        changOrigin: true,
        pathRewrite: {
          '^api': ''
        }
      }
    },
    before: app => { }
  },


}
